import QtQuick 2.12
import QtQuick.Window 2.12
import QtQuick.Controls 2.5
import QtQuick.Layouts 1.3

Window {
    id:window
    visible: true
    width: 640
    height: 480
    title: qsTr("Hello World")
    color: "#00000000"

    Item{
        id:topBar
        width: parent.width
        height: 50

        Button{
            text: "菜单"
            onClicked: {
                menu.popup()
            }
        }
        Menu{
            id:menu
            Repeater{
                model: listModel
                MenuItem {
                    text: btnText
                    onTriggered: {
                        loaderEp.source = src
                    }
                }
            }
        }
    }


    Loader{
        id:loaderEp
        anchors.top: topBar.bottom
        anchors.bottom: parent.bottom
        width: parent.width
        source: listModel.get(0).src

        Rectangle{
            border.color: "red"
            border.width: 1
            anchors.fill: parent
        }
    }

    ListModel{
        id:listModel
        ListElement{btnText:"EpChristmas";src:"qrc:///EpChristmas/EpChristmas.qml"}
        ListElement{btnText:"EpFireworks";src:"qrc:///EpFireworks/EpFireworks.qml"}
        ListElement{btnText:"EpPaopao";src:"qrc:///EpPaopao/EpPaopao.qml"}
    }

    ButtonGroup{
        id:btnGp
        onClicked: {
            console.log(button.text)
        }
    }

    Component.onCompleted: {
        window.showMaximized()
    }
}
